package com.goktech.project.hmw.controller;

import com.goktech.project.hmw.mapper.Fwlsj;
import com.goktech.project.hmw.service.IFwlsjService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/fwlsj")
public class FwlsjController {

	@Autowired
	private IFwlsjService fwlsjService;

	/**
	 * 通过area_id获取访问两数据
	 *
	 * @param reqMap
	 * @return
	 */
	@PostMapping("/area")
	public List<Fwlsj> listFwlsjByArea_id(@RequestBody Map<String, String> reqMap) {
		return fwlsjService.listFwlsjByArea_id(reqMap.get("area_id"));
	}

	/**
	 * 通过访问方式返回访问量集合
	 *
	 * @param reqMap
	 * @return
	 */
	@PostMapping("/type")
	public List<Fwlsj> listFwlsjByVisit_type(@RequestBody Map<String, String> reqMap) {
		return fwlsjService.listFwlsjByVisit_type(reqMap.get("visit_type"));
	}

	/**
	 * 通过开始时间结束时间返回访问量数据集合
	 *
	 * @param reqMap
	 * @return
	 */
	@PostMapping("/time")
	public List<Fwlsj> listFwlsjByTime(@RequestBody Map<String,String> reqMap) {
		return fwlsjService.listFwlsjByTime(reqMap.get("starttime"), reqMap.get("endtime"));
	}
}
